<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>提现管理</title>
    <!-- Le styles -->
    <link href="/common/js/bootstrap-3.0.0/css/bootstrap-united.min.css" rel="stylesheet">
    <link href="/common/css/toast.css" rel="stylesheet">
    <style type="text/css">
        body {
            padding: 10px 0;
        }
    </style>
</head>
<body onload="toastFunction();">
<div class="container">
<#--<form id="form" method="post" class="well form-horizontal">
    <fieldset>
        <legend>通知管理</legend>
        <div class="form-group">
            <div class="col-md-4">
                <label class="col-md-4 control-label" for="username">登录名</label>

                <div class="col-md-8">
                    <input id="username" name="username" type="text" class="form-control"/>
                </div>
            </div>

            <div class="col-md-4">
                <label class="col-md-4 control-label" for="datetime">日期</label>

                <div class="col-md-8">
                    <input id="datetime" name="datetime" class="form-control Wdate"
                           onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                </div>
            </div>

            <div class="col-md-4">
                <label class="col-md-4 control-label" for="logtype">操作行为</label>

                <div class="col-md-8">
                    <select id="logtype" name="logtype" class="form-control">
                        <option value=""></option>
                        <option value="用户登陆">用户登陆</option>
                        <option value="登陆失败">登陆失败</option>
                        <option value="用户注销">用户注销</option>
                        <option value="新增资源">新增资源</option>
                        <option value="修改资源">修改资源</option>
                        <option value="删除资源">删除资源</option>
                        <option value="添加角色">添加角色</option>
                        <option value="删除角色">删除角色</option>
                        <option value="编辑角色权限">编辑角色权限</option>
                        <option value="添加用户">添加用户</option>
                        <option value="删除用户">删除用户</option>
                        <option value="修改用户">修改用户</option>
                        <option value="修改密码">修改密码</option>
                        <option value="修改规则">修改规则</option>
                        <option value="删除规则">删除规则</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-12 text-right">
                <a style="width: 80px;" href="/msg/addPushMsgView" class="btn btn-success">新建推送</a>
                <button type="button" id="searchBtn" style="width: 80px;" class="btn btn-primary">查询</button>
            </div>
        </div>
    </fieldset>
</form>-->

    <#--<div class="col-md-12 text-right" style="margin:10px 0;">-->
        <#--<a style="width: 80px;" href="/account/addWithdrawView" class="btn btn-success">新建</a>-->
    <#--</div>-->

    <table id="resultTable" class="table table-bordered table-hover">
        <thead>
        <tr>
            <th>编号</th>
            <th>用户</th>
            <th>用户账户余额</th>
            <th>提现银行</th>
            <th>提现账号</th>
            <th>提现金额(元)</th>
            <th>状态</th>
            <th>描述</th>
            <th>申请时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <script type="text/html">
            <tr>
                <td>{{id}}</td>
                <td>{{user.cnName}}</td>
                <td>{{user.money}}</td>
                <td>{{byUserWithdrawAccount.openFrom}}</td>
                <td>{{byUserWithdrawAccount.accountNum}}</td>
                <td>{{amount}}</td>
                <td>{{status?renderStatus}}</td>
                <td>{{descn!''}}</td>
                <td>{{updateTime?parseDate}}</td>
                <td>{{_self_data?renderStatusOperation}}</td>
            </tr>
        </script>
        </tbody>
    </table>
</div>
<div id="snackbar"><#if result??>${result}</#if></div>
<script type="text/javascript" src="/common/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap-table.20130913.js"></script>
<script type="text/javascript" src="/common/js/dateformat.js"></script>
<script type="text/javascript" src="/common/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function () {
        var param = $("#form").serialize();
        var s = $("#resultTable").bsTable({
            url: '/account/getWithdrawList.json',
            ajaxType: "POST",  //ajax 提交方式 post 或者 get
            pageNo: 1,
            pageNoAlias: 'page',
            pageSize: 10,
            pageSizeAlias: 'pageSize',
            pagingAlign: "right",
            param: param,
            countRoot: "total",
            dataRoot: "list"
        });

        $("#searchBtn").on('click', function () {
            var param = $("#form").serialize();
            s.reload(param);
        });

//        window.onresize = function () {
//            window.top.autoIFrame();
//        }
    });

    function renderStatus(status) {
        if (status == -1) {
            return "等待提交";
        } else if(status == 1) {
            return "已提交申请";
        } else if(status == 2) {
            return "财务审核通过,待转账";
        }else{
            return "打款完成";
        }
    }

    function renderStatusOperation(row) {
        var rowId = row.id;
        if (row){
            if (row.status == 1){
                return '<a style="width: 80px;" href="/account/changeWithdrawStatus?id='+rowId+'&status=2" class="btn btn-success">同意提现</a>';
            }else if(row.status == 2){
                return '<a style="width: 80px;" href="/account/changeWithdrawStatus?id='+rowId+'&status=3" class="btn btn-success">打款完成</a>';
            }
        }
        return "";
    }

</script>
<script>
    function toastFunction() {
        var x = document.getElementById("snackbar")
        if (x.innerHTML =="" || undefined || null){
            return;
        }
        x.className = "show";
        setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
    }
</script>
</body>
</html>